package com.jp.knowledge.adapter.attention;

import android.content.Context;
import android.support.annotation.NonNull;

import com.jp.knowledge.R;
import com.jp.knowledge.model.attention.Atatistics;
import com.jp.knowledge.my.base.RecycleVAdapter;
import com.jp.knowledge.my.base.RecycleVHolder;

import java.util.List;

/**
 * Created by 528787067@qq.com on 2017/3/20.
 */

public class AttentionGroupStatisiticsAdapter extends RecycleVAdapter<Atatistics> {

    public AttentionGroupStatisiticsAdapter(Context context, @NonNull List<Atatistics> list) {
        super(context, list);
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.attention_statisitics_item;
    }

    @Override
    public void onBind(RecycleVHolder holder, int position) {
        Atatistics data = getData(position);
        holder.setImageUrl(R.id.statisitics_icon, data.getIcon());
        holder.setTextView(R.id.statisitics_title, data.getTypeName());
        holder.setTextView(R.id.statisitics_count, data.getCount()+"");
        if(data.getCount() == 0)
            holder.getTextView(R.id.statisitics_count).setTextColor(mContext.getResources().getColor(R.color.font_gray));
        else
            holder.getTextView(R.id.statisitics_count).setTextColor(mContext.getResources().getColor(R.color.orange));
    }
}
